package com.example.sentinel.service;

import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Service;

/**
 * 限流业务逻辑
 * @author chengjian 
 * @date 2021/6/30
 */
@Service
@Slf4j
public class SentinelService {

    /**
     * 流控测试
     * @return String
     */
    public String limitStream(){
        return "OK";
    }

    /**
     * 降级测试
     * @param uid uid
     * @return String
     * @throws InterruptedException 线程异常
     */
    public String degrade(String uid) throws InterruptedException {
        // rpc调用，根据uid获取推荐列表
        Thread.sleep(2000);

        return "推荐列表";
    }
}
